Skip to content

fix(cli): read AGENT_BROWSER_CDP from environment variable#394

Open
anthrotype wants to merge 1 commit intovercel-labs:mainfrom
anthrotype:fix/cdp-env-var
Open

fix(cli): read AGENT_BROWSER_CDP from environment variable#394
anthrotype wants to merge 1 commit intovercel-labs:mainfrom
anthrotype:fix/cdp-env-var

Conversation

@anthrotype
Copy link

Summary

The --cdp flag allows connecting to an existing browser via CDP, but unlike every other CLI flag (AGENT_BROWSER_EXECUTABLE_PATH, AGENT_BROWSER_PROFILE, AGENT_BROWSER_PROXY, AGENT_BROWSER_ARGS, etc.), it had no environment variable fallback. The default was hardcoded to None.

This one-line fix reads AGENT_BROWSER_CDP from the environment, following the exact same pattern as all sibling flags in flags.rs.

Use case

Users who always connect to an existing browser via CDP (e.g., a remote Chrome instance over SSH tunnel) had to pass --cdp <port> on every single invocation. With this fix, they can set AGENT_BROWSER_CDP=9223 once in their shell profile and all commands just work.

Before

# Every command needs --cdp
agent-browser --cdp 9223 open https://example.com
agent-browser --cdp 9223 snapshot -i
agent-browser --cdp 9223 tab list

After

export AGENT_BROWSER_CDP=9223
agent-browser open https://example.com
agent-browser snapshot -i
agent-browser tab list

Changes

  • cli/src/flags.rs: cdp: Nonecdp: env::var("AGENT_BROWSER_CDP").ok()

The --cdp flag allows connecting to an existing browser via CDP, but
unlike every other flag (AGENT_BROWSER_EXECUTABLE_PATH, AGENT_BROWSER_PROFILE,
AGENT_BROWSER_PROXY, etc.), it had no environment variable fallback.

This means users who always connect via CDP had to pass --cdp on every
invocation instead of setting it once via AGENT_BROWSER_CDP.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Feb 8, 2026

@anthrotype is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant